package com.yiqi.liebang.feature.news.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.liebang.entity.bo.PageBo;
import com.yiqi.liebang.entity.bo.MessageBo;
import com.yiqi.liebang.feature.news.contract.MessageContract;
import com.yiqi.liebang.feature.news.dependencies.message.DaggerMessageModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.UserApi;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class MessageModel implements MessageContract.Model {

    @Inject
    UserApi api;


    @Inject
    public MessageModel() {
        DaggerMessageModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<MessageBo>> getMessageList(PageBo pageBo) {
        return api.getMessageCenter(pageBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

}
